package yedean.bean;

import com.yedean.factory.support.DisposableBean;
import com.yedean.factory.support.InitializingBean;
import lombok.ToString;

import java.lang.reflect.InvocationTargetException;

/**
 * UserService
 *
 * @author yedean
 * @date 2022/6/27
 */
@ToString
public class UserService implements InitializingBean, DisposableBean {
    private String uId;
    
    private String location;
    
    private String company;
    
    private UserDao userDao;

    public String getuId() {
        return uId;
    }

    public void setuId(String uId) {
        this.uId = uId;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public String getCompany() {
        return company;
    }

    public void setCompany(String company) {
        this.company = company;
    }

    public UserDao getUserDao() {
        return userDao;
    }

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }

    public UserService(String uId, UserDao userDao) {
        this.uId = uId;
        this.userDao = userDao;
    }

    public UserService() {
    }

    public String queryUserInfo() {
        return userDao.queryUserName(uId)+", 公司："+company+", 地点"+location;
    }


    @Override
    public void destroy() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        System.out.println("执行：UserService.destroy");
    }
        
    @Override
    public void afterPropertySet() {
        System.out.println("执行：UserService.afterPropertiesSet");
    }
    
    public void initMethod(){
        System.out.println("执行userService的初始化方法");
    }
    
    public void destroyMethod(){
        System.out.println("执行userService的销毁方法");
    }
}
